/**
 * @author Vitor Franco do Carmo (vitor.carmo@cpmbraxis.com)
 * @since 03/08/2013
 *
 */
package br.com.vfcfw.test.functional.exemplo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import br.com.vfcfw.test.BaseTesteFuncional;
import br.com.vfcfw.test.functional.BasePagina;


/**
 * @author Vitor Franco do Carmo (vitor.carmo@cpmbraxis.com)
 * @since 03/08/2013
 * 
 */
public class DeliciousHome extends BasePagina {

    @FindBy(css = "a#sign-in-link.nav-link")
    private WebElement loginButton;

    public DeliciousHome() {

        super(BaseTesteFuncional.obterDriverAtual());
    }

    /**
     * Construtor da classe.
     * 
     * @param driver {@link WebDriver}.
     */
    public DeliciousHome(WebDriver driver) {

        super(driver);
    }

    /**
     * Navega para a página home do delicious.
     * 
     * @return {@link DeliciousHome}.
     */
    public DeliciousHome navegarParaHome() {

        comandos.abrir("http://www.delicious.com/");
        return obterProximaPagina(DeliciousHome.class);
    }

    /**
     * Abre a tela de login.
     * 
     * @return {@link DeliciousLogin}.
     */
    public DeliciousLogin tentarLogin() {

        comandos.esperarElementoVisivel(loginButton);
        comandos.clicar(loginButton);
        return obterProximaPagina(DeliciousLogin.class);
    }

}
